<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>权限添加</title>
    <link rel="stylesheet" href="//unpkg.com/layui@2.6.8/dist/css/layui.css">

</head>
<body>
<form class="layui-form" action="{:url('save')}" method="post" id="commentForm">
    <div class="layui-form-item">
        <label class="layui-form-label">权限名称</label>
        <div class="layui-input-inline">
            <input type="text" name="n_name" lay-verify="required" autocomplete="off" placeholder="请输入标题" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">父类权限名称</label>
            <div class="layui-input-inline">
                <select name="pid">
                    {foreach $data as $v}
                    <option value="{$v.id}">{$v.n_name}</option>
                    {/foreach}

                </select>
            </div>
        </div>


    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">控制器名字</label>
            <div class="layui-input-inline">
                <input type="text" name="c_name" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">方法名字</label>
            <div class="layui-input-inline">
                <input type="text" name="f_name" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <button type="submit" class="layui-btn layui-btn-primary layui-border-green">提交</button>
</form>
</body>
</html>
<script src="//unpkg.com/layui@2.6.8/dist/layui.js"></script>
<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>
<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/localization/messages_zh.js"></script>
<script>
    $().ready(function() {
        $("#commentForm").validate({
            rules:{
                n_name:{
                    required:true
                },
                c_name:{
                    required:true
                },
                f_name:{
                    required:true
                }
            },
            messages:{
                n_name:{
                    required:"<span style='color:red;'>权限名称不能为空!</span>"
                },
                c_name:{
                    required:"<span style='color:red;'>控制器名称不能为空!</span>"
                },
                f_name:{
                    required:"<span style='color:red;'>方法名称称不能为空!</span>"
                }
            }
        });
    });
</script>